class Dictionary < ActiveRecord::Base

  attr_accessor :info

	has_many :word_definitions, :dependent => :delete_all
  has_many :words, :through => :word_definitions

  before_create :complete_missing_name

  validates_presence_of :dictionary_id
  validates_uniqueness_of :dictionary_id

  def self.per_page
    5
  end

  def complete_missing_name
    self.name = dictionary_id.titleize if name.blank?
  end

end
